home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / copsnrob.c < prev    next >
C/C++ Source or Header  |  2000-05-13  |  9KB  |  282 lines

  1. /***************************************************************************
  2.  
  3. Cops'n Robbers memory map (preliminary)
  4.  
  5. driver by Zsolt Vasvari
  6.  
  7.  
  8. 0000-00ff RAM
  9. 0c00-0fff Video RAM
  10. 1200-1fff ROM
  11.  
  12. I/O Read:
  13.  
  14. 1000 Vertical Sync
  15. 1002 Bit 0-6 Player 1 Gun Position
  16.      Bit 7   Player 1 Gas Pedal
  17. 1006 Same as above for Player 2
  18. 100A Same as above for Player 3
  19. 100E Same as above for Player 4
  20. 1012 DIP Switches
  21.      0-1 Coinage
  22.      2-3 Time Limit
  23.      4-7 Fire button for Player 1-4
  24. 1016 Bit 6 - Start 1
  25.      Bit 7 - Coin 1
  26. 101A Bit 6 - Start 2
  27.      Bit 7 - Coin 2
  28.  
  29. I/O Write:
  30.  
  31. 0500-0503 Direction of the cars
  32. 0504-0507 ???
  33. 0600      Beer Truck Y
  34. 0700-07ff Beer Truck Sync Area
  35. 0800-08ff Bullets RAM
  36. 0900-0903 Car Sprite #
  37. 0a00-0a03 Car Y Pos
  38. 0b00-0bff Car Sync Area
  39. 1000      ??? Sound effect and start led triggers must be here
  40. 1001-1003 ???
  41.  
  42. ***************************************************************************/
  43.  
  44. #include "driver.h"
  45. #include "vidhrdw/generic.h"
  46.  
  47. extern unsigned char *copsnrob_bulletsram;
  48. extern unsigned char *copsnrob_carimage;
  49. extern unsigned char *copsnrob_cary;
  50. extern unsigned char *copsnrob_trucky;
  51.  
  52. READ_HANDLER( copsnrob_gun_position_r );
  53. int copsnrob_vh_start(void);
  54. void copsnrob_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  55.  
  56. static struct MemoryReadAddress readmem[] =
  57. {
  58.     { 0x0000, 0x01ff, MRA_RAM },
  59.     { 0x0800, 0x08ff, MRA_RAM },
  60.     { 0x0b00, 0x0bff, MRA_RAM },
  61.     { 0x0c00, 0x0fff, MRA_RAM },
  62.     { 0x1000, 0x1000, input_port_0_r },
  63.     { 0x1002, 0x100e, copsnrob_gun_position_r},
  64.     { 0x1012, 0x1012, input_port_3_r },
  65.     { 0x1016, 0x1016, input_port_1_r },
  66.     { 0x101a, 0x101a, input_port_2_r },
  67.     { 0x1200, 0x1fff, MRA_ROM },
  68.     { 0xfff8, 0xffff, MRA_ROM },
  69.     { -1 }  /* end of table */
  70. };
  71.  
  72. static struct MemoryWriteAddress writemem[] =
  73. {
  74.     { 0x0000, 0x01ff, MWA_RAM },
  75.     { 0x0500, 0x0503, MWA_RAM },
  76.     { 0x0504, 0x0507, MWA_NOP },  // ???
  77.     { 0x0600, 0x0600, MWA_RAM, &copsnrob_trucky },
  78.     { 0x0700, 0x07ff, MWA_RAM },
  79.     { 0x0800, 0x08ff, MWA_RAM, &copsnrob_bulletsram },
  80.     { 0x0900, 0x0903, MWA_RAM, &copsnrob_carimage },
  81.     { 0x0a00, 0x0a03, MWA_RAM, &copsnrob_cary },
  82.     { 0x0b00, 0x0bff, MWA_RAM },
  83.     { 0x0c00, 0x0fff, videoram_w, &videoram, &videoram_size },
  84.     { 0x1000, 0x1003, MWA_NOP },
  85.     { 0x1200, 0x1fff, MWA_ROM },
  86.     { 0xfff8, 0xffff, MWA_ROM },
  87.     { -1 }  /* end of table */
  88. };
  89.  
  90.  
  91. INPUT_PORTS_START( copsnrob )
  92.     PORT_START      /* IN0 */
  93.     PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_VBLANK )
  94.  
  95.     PORT_START      /* IN1 */
  96.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  97.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  98.  
  99.     PORT_START      /* IN2 */
  100.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  101.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  102.  
  103.     PORT_START      /* DIP1 */
  104.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
  105.     PORT_DIPSETTING(    0x03, "1 Coin/1 Player" )
  106.     PORT_DIPSETTING(    0x02, "1 Coin/2 Players" )
  107.     PORT_DIPSETTING(    0x01, "1 Coin/Game" )
  108.     PORT_DIPSETTING(    0x00, "2 Coins/1 Player" )
  109.     PORT_DIPNAME( 0x0c, 0x00, "Time Limit" )
  110.     PORT_DIPSETTING(    0x0c, "1min" )
  111.     PORT_DIPSETTING(    0x08, "1min 45sec" )
  112.     PORT_DIPSETTING(    0x04, "2min 20sec" )
  113.     PORT_DIPSETTING(    0x00, "3min" )
  114.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4)
  115.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3)
  116.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2)
  117.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1)
  118.  
  119.     /* These input ports are fake */
  120.     PORT_START      /* IN3 */
  121.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP   | IPF_PLAYER1 | IPF_4WAY )
  122.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_4WAY )
  123.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  124.  
  125.     PORT_START      /* IN4 */
  126.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP   | IPF_PLAYER2 | IPF_4WAY )
  127.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_4WAY )
  128.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  129.  
  130.     PORT_START      /* IN5 */
  131.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP   | IPF_PLAYER3 | IPF_4WAY )
  132.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_PLAYER3 | IPF_4WAY )
  133.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  134.  
  135.     PORT_START      /* IN6 */
  136.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP   | IPF_PLAYER4 | IPF_4WAY )
  137.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_PLAYER4 | IPF_4WAY )
  138.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
  139. INPUT_PORTS_END
  140.  
  141.  
  142. static struct GfxLayout charlayout =
  143. {
  144.     8,8,    /* 8*8 characters */
  145.     64,     /* 64 characters */
  146.     1,      /* 1 bit per pixel */
  147.     { 0 },  /* no separation in 1 bpp */
  148.     { 0, 1, 2, 3, 4, 5, 6, 7},
  149.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  150.     8*8     /* every char takes 8 consecutive bytes */
  151. };
  152.  
  153. static struct GfxLayout carlayout =
  154. {
  155.     32,32,    /* 32*32 sprites */
  156.     16,       /* 16 sprites */
  157.     1,        /* 1 bit per pixel */
  158.     { 0 },    /* no separation in 1 bpp */
  159.     {  7,  6,  5,  4,  3,  2,  1,  0,
  160.       15, 14, 13, 12, 11, 10,  9,  8,
  161.       23, 22, 21, 20, 19, 18, 17, 16,
  162.       31, 30, 29, 28, 27, 26, 25, 24},
  163.     {  0*32,  1*32,  2*32,  3*32,  4*32,  5*32,  6*32,  7*32,
  164.        8*32,  9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32,
  165.       16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32,
  166.       24*32, 25*32, 26*32, 27*32, 28*32, 29*32, 30*32, 31*32 },
  167.     32*32     /* every sprite takes 128 consecutive bytes */
  168. };
  169.  
  170. static struct GfxLayout trucklayout =
  171. {
  172.     16,32,    /* 16*32 sprites */
  173.     2,        /* 2 sprites */
  174.     1,        /* 1 bit per pixel */
  175.     { 0 },    /* no separation in 1 bpp */
  176.     { 3*256+4, 3*256+5, 3*256+6, 3*256+7, 2*256+4, 2*256+5, 2*256+6, 2*256+7,
  177.       1*256+4, 1*256+5, 1*256+6, 1*256+7, 0*256+4, 0*256+5, 0*256+6, 0*256+7 },
  178.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  179.       8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8,
  180.       16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,
  181.       24*8, 25*8, 26*8, 27*8, 28*8, 29*8, 30*8, 31*8 },
  182.     32*32     /* every sprite takes 128 consecutive bytes */
  183. };
  184.  
  185.  
  186. static struct GfxDecodeInfo gfxdecodeinfo[] =
  187. {
  188.     { REGION_GFX1, 0, &charlayout,  0, 1 },
  189.     { REGION_GFX2, 0, &carlayout,   0, 1 },
  190.     { REGION_GFX3, 0, &trucklayout, 0, 1 },
  191.     { -1 } /* end of array */
  192. };
  193.  
  194. static unsigned char palette[] =
  195. {
  196.     0x00,0x00,0x00, /* black */
  197.     0xff,0xff,0xff  /* white */
  198. };
  199. static unsigned short colortable[] =
  200. {
  201.     0x00, 0x01
  202. };
  203. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  204. {
  205.     memcpy(game_palette,palette,sizeof(palette));
  206.     memcpy(game_colortable,colortable,sizeof(colortable));
  207. }
  208.  
  209.  
  210. static struct MachineDriver machine_driver_copsnrob =
  211. {
  212.     /* basic machine hardware */
  213.     {
  214.         {
  215.             CPU_M6502,
  216.             14318180/16, /* 894886.25 kHz */
  217.             readmem,writemem,0,0,
  218.             ignore_interrupt,1
  219.         }
  220.     },
  221.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,  /* frames per second, vblank duration */
  222.     1,      /* single CPU, no need for interleaving */
  223.     0,
  224.  
  225.     /* video hardware */
  226.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 26*8-1 },
  227.     gfxdecodeinfo,
  228.     2+32768, 2,
  229.     init_palette,
  230.  
  231.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  232.     0,
  233.     copsnrob_vh_start,
  234.     0,
  235.     copsnrob_vh_screenrefresh,
  236.  
  237.     /* sound hardware */
  238.     0,0,0,0
  239. };
  240.  
  241.  
  242.  
  243.  
  244.  
  245. /***************************************************************************
  246.  
  247.   Game driver(s)
  248.  
  249. ***************************************************************************/
  250.  
  251. ROM_START( copsnrob )
  252.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  253.     ROM_LOAD( "5777.l7",      0x1200, 0x0200, 0x2b62d627 )
  254.     ROM_LOAD( "5776.k7",      0x1400, 0x0200, 0x7fb12a49 )
  255.     ROM_LOAD( "5775.j7",      0x1600, 0x0200, 0x627dee63 )
  256.     ROM_LOAD( "5774.h7",      0x1800, 0x0200, 0xdfbcb7f2 )
  257.     ROM_LOAD( "5773.e7",      0x1a00, 0x0200, 0xff7c95f4 )
  258.     ROM_LOAD( "5772.d7",      0x1c00, 0x0200, 0x8d26afdc )
  259.     ROM_LOAD( "5771.b7",      0x1e00, 0x0200, 0xd61758d6 )
  260.     ROM_RELOAD(               0xfe00, 0x0200 ) // For 6502 vectors
  261.  
  262.     ROM_REGION( 0x0200, REGION_GFX1 | REGIONFLAG_DISPOSE )
  263.     ROM_LOAD( "5782.m3",      0x0000, 0x0200, 0x82b86852 )
  264.  
  265.     ROM_REGION( 0x0800, REGION_GFX2 | REGIONFLAG_DISPOSE )
  266.     ROM_LOAD( "5778.p1",      0x0000, 0x0200, 0x78bff86a )
  267.     ROM_LOAD( "5779.m1",      0x0200, 0x0200, 0x8b1d0d83 )
  268.     ROM_LOAD( "5780.l1",      0x0400, 0x0200, 0x6f4c6bab )
  269.     ROM_LOAD( "5781.j1",      0x0600, 0x0200, 0xc87f2f13 )
  270.  
  271.     ROM_REGION( 0x0100, REGION_GFX3 | REGIONFLAG_DISPOSE )
  272.     ROM_LOAD( "5770.m2",      0x0000, 0x0100, 0xb00bbe77 )
  273.  
  274.     ROM_REGION( 0x0060, REGION_PROMS )     /* misc. PROMs (timing?) */
  275.     ROM_LOAD( "5765.h8",      0x0000, 0x0020, 0x6cd58931 )
  276.     ROM_LOAD( "5766.k8",      0x0020, 0x0020, 0xe63edf4f )
  277.     ROM_LOAD( "5767.j8",      0x0040, 0x0020, 0x381b5ae4 )
  278. ROM_END
  279.  
  280.  
  281. GAMEX( 1976, copsnrob, 0, copsnrob, copsnrob, 0, ROT0, "Atari", "Cops'n Robbers", GAME_NO_SOUND )
  282.